import 'dart:convert';
import 'dart:io';
import 'package:homepad/iot/basic_types.dart';
import 'package:homepad/iot/message_def.dart';
import 'package:homepad/logger/logger.dart';
import 'package:homepad/iot/nova_config.dart';

void main(List<String> arguments) async {
  final data = await File("./assets/homepad_config.json").readAsString();

  final map = jsonDecode(data) as Map<String, dynamic>;
  final config = NovaConfig.fromJson(map);
  logger.info("remote_url: ${config.remoteUrl}");
  logger.info("location: ${config.location}");

  for (var item in config.nodes) {
    item.onAttributeReport(AttributePathIB(endpoint: 144,
        cluster: ClusterIds.bridgedDeviceBasicInformation,
        attribute: BasicInformationAttributeIds.reachable),
        false);
  }
}
